import React, { Component, } from 'react'
import { View,StyleSheet,Image,Text,Dimensions } from 'react-native'
import TitleWithLine from './TitleWithLine';
const {height,width} = Dimensions.get('window');
class GoodList extends Component {

  static propTypes = {}

  static defaultProps = {}

  constructor(props) {
    super(props)
    this.state = {}
  }

  render() {
    const {
      items,
    } = this.props;
    return (
      <View style={styles.container}>
        <TitleWithLine title='最新上架' />
        <View style={styles.itemContainer}>
            {items.map((item, key) => {
              return (
                <View key={key} style={styles.item}>
                     <Image  style={styles.img} resizeMode='contain'  source={{uri: item.image}}/>
                     <View style={{flex:1,padding:5}}>
                      <Text numberOfLines={2} style={{fontSize:12,color:'#000',lineHeight:18}}>{item.title}</Text>
                      <Text style={{color:'#ff5001'}}>¥ {item.price}</Text>
                     </View>
                </View>
              )
            })}
          </View>
        </View>
    )
  }
}

const styles = StyleSheet.create({
  container:{
    flex:1
  },
  itemContainer:{
    flexDirection:'row',flexWrap:'wrap',justifyContent:'space-between'
  },
  item: {
    backgroundColor: '#fff',
    width: width / 2 - 2,
    height: (width / 2 - 2) + 70,
    marginBottom: 4
  },
  img: {
    width: width / 2 - 2,
    height: width / 2 - 2,
  },
});

export default GoodList